package week03.single;

/**
 * Created by zhangxiaokun on 2018/2/8.
    延迟加载， 但效率低
 */
public class
Singleton02 {
    private static Singleton02 instance;
    private Singleton02(){
        System.out.println("...Singleton02 is create");
    }

    public static synchronized Singleton02 getInstance() {
        if (instance == null) {
            instance = new Singleton02();
        }
        return instance;
    }

    public static void axx() {  //用于测试观察 实例是否延迟加载
        System.out.println("--Singleton02.axx() run...");
    }
}
